#!/bin/sh

#
# Allows the user to override environmental variables if wanted. Only
# sets the environmental variable if the environmental variable has
# not already been set.
#
set_ifn()
{
	var=$1
	shift
	val=$1

	cmd="echo \$$var"
	existing=`eval $cmd`

	if [ -z "$existing" ]; then
		export $var=$val
	fi
}

set_ifn CELLD_DBFILE  celld.db
set_ifn CELLD_LOGDIR  /tmp
set_ifn CELLD_APIADDR celld.sock
set_ifn CELLD_MODEM_1 gsm1,/dev/ttyACM0,230400

export PYTHONPATH=.

exec python cellular/celld.py $* 
